package com.yhc.mq.controller;

import com.yhc.mq.mq.RocketMQUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class MqTest {

    @Value("${rocketmq.topic}")
    private String topic;

    @Autowired
    RocketMQUtil rocketMQUtil;

    @RequestMapping("mq")
    public String testMq(@RequestParam("content") String content) {
        rocketMQUtil.sendAsyncMessage(content, topic);
        return "success";
    }

}
